<#include "/common/head.ftl">

<@showTitle title="${i18n.getMessage('nextOffering')} > ${i18n.getMessage('add')}">
	<a href="#" onclick="cc('offering/showInfoOffering.sgt?id=${(offering.id)!}')">${i18n.getMessage('offering')}</a>
</@showTitle>

<div id="error" style="display:none"></div>

<form action="offering/addNextOffering.sgt" validator="offering/validateNextOffering.sgt" onsubmit="submitFormValidation(this); return false;" onreset="$('error').hide()">
	<input type="hidden" name="offeringId" value="${(offering.id)!}"/>
	<table id="dataTable" cellspacing="5" cellpadding="0" align="center">
		<tr>
			<td class="name">${i18n.getMessage('name')}:</td>
			<td><input type="text" name="name" style="width:200px"/></td>
		</tr>
		<tr> 
			<td class="name1">${i18n.getMessage('program')}:</td>
			<td>
				<select id="programId" name="programId" style="width:194px">
					<option value="0"></option>
					<#list programs as program>
						<option value="${program.id}" <#if program=(offering.level.program)!>selected</#if>>${program.name}</option>
					</#list>
				</select> <span id="progressMsg"></span>
			</td>
		</tr>
		<tr>
			<td class="name1">${i18n.getMessage('level')}:</td>
			<td>
				<select id="levelId" name="levelId" style="width:194px">
					<option></option>
				</select>
			</td>
		</tr>
		<tr>
			<td class="name">${i18n.getMessage('startDate')}:</td>
			<td><input type="text" value="${(startDate?date)!}" name="startDate" style="width:200px"/><img class="calendarImg" src="images/calendar/calendar.gif" onclick="displayCalendar(document.forms[0].startDate, '${i18n.getMessage('format.date')}', this)"/></td>
		</tr>
		<tr>
			<td class="name">${i18n.getMessage('endDate')}:</td>
			<td><input type="text" value="${(endDate?date)!}" name="endDate" style="width:200px"/><img class="calendarImg" src="images/calendar/calendar.gif" onclick="displayCalendar(document.forms[0].endDate, '${i18n.getMessage('format.date')}', this)"/></td>
		</tr>
		<tr>
			<td class="name">${i18n.getMessage('shift')}:</td>
			<td>
				<select name="shiftId" style="width:204px">
					<option></option>
					<#list shifts as shift>
						<option value="${(shift.id)!}" <#if shift=(offering.shift)!>selected</#if>>${(shift.startTime?time)!}-${(shift.endTime?time)!}</option>
					</#list>
				</select>
			</td>
		</tr>
		<tr>
			<td class="name"></td>
			<td>
				<input type="submit" value="${i18n.getMessage('update')}" class="button_style"/> 
				<input type="reset" value="${i18n.getMessage('reset')}" class="button_style"/> 
			</td>
		</tr>
	</table>
</form>

<@ajax.select baseUrl="programlevelsearch.view" source="programId" target="levelId"
	parameters="programId={programId}" executeOnLoad=true defaultOptions="${(nextLevel.id)!}"/>